<div class="bjui-pageContent">

    <div class="bjui-pageHeader">
        <div class="toolBar">
            <div class="btn-group" role="group" aria-label="操作栏">
            <#--<a type="button" class="btn btn-success" href="${wwwroot}/admin/job/add" data-toggle="navtab" data-id="form"><i class="fa fa-plus"></i>新增</a>-->
                    <#--<a type="button" class="btn btn-danger" href="${wwwroot}/admin/job/delete?ids={#bjui-selected}" data-toggle="doajax" data-confirm-msg="确定要删除选中项吗？" data-id="form" data-mask="true"><i class="fa fa-trash-o"></i>删除选中行</a>-->
            </div>
        </div>
        <form id="pagerForm" data-toggle="ajaxsearch" action="${wwwroot}/admin/job/listaudit" method="post">
            <input type="hidden" name="pageSize" value="">
            <input type="hidden" name="pageCurrent" value="">
            <input type="hidden" name="orderField" value="">
            <input type="hidden" name="orderDirection" value="">
            <div class="bjui-searchBar">
                <label>名称：</label><input type="text" id="name" name="name" value="${(job.name)!}"  class="form-control" size="10">&nbsp;
                <label>状态：</label><input type="text" id="status" name="status" value="${(job.status)!}"  class="form-control" size="10">&nbsp;
                <button type="submit" class="btn btn-primary" data-icon="search">查询</button>&nbsp;
                <a class="btn btn-orange" href="javascript:;" onclick="$(this).navtab('reloadForm', true);" data-icon="undo">清空查询</a>
            </div>
        </form>
    </div>
    <div class=" tableContent">
        <div style="float:left; width:500px;">
            <table id="test-datagrid-array" data-width="100%" data-height="70%" class="table table-bordered">
                <thead>
                <tr>
                    <th width="20">No.</th>
                    <th data-order-direction="" data-order-field="name">名称</th>
                    <th data-order-direction="" data-order-field="status" width="50">运行状态</th>
                    <th data-order-direction="" data-order-field="auditState" width="50">审核状态</th>
                    <th data-order-direction="" data-order-field="status" width="50">创建人</th>
                    <th data-order-direction="" data-order-field="createDate" width="50">创建时间</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                <#list pageCtx.rows as row>
                <tr id="tr_${(row.id)!}" data-id="${(row.id)!}" onclick="listByJob('${(row.id)!}')">
                    <td>${(row_index+1)!}</td>
                    <td title="${(row.name)!}">${(row.name)!}</td>
                    <td title="${(row.status.label)!}">${(row.status.label)!}</td>
                    <td title="${(row.auditState.label)!}">${(row.auditState.label)!}</td>
                    <td title="${(row.createrName)!}">${(row.createrName)!}</td>
                    <td title="${(row.createDate?string('yy/MM/dd HH:mm:ss'))!}">${(row.createDate?string('yy/MM/dd HH:mm:ss'))!}</td>
                    <td>
                        <#--<#if row.auditState!='AUDIT_YES'>-->
                            <#--<#if row.status=='NEW'>-->
                                <#--<a href="${wwwroot}/admin/job/runtest?id=${(row.id)!}" class="btn btn-default" data-toggle="doajax" >运行测试</a>-->
                            <#--<#elseif row.status=='EXEC_TEST'>-->
                                <#--<a href="${wwwroot}/admin/job/runstandard?id=${(row.id)!}" class="btn btn-default" data-toggle="doajax" >运行标准</a>-->
                            <#--</#if>-->

                        <#--<#else>-->
                            <#--<#if row.status=='READY'>-->
                                <#--<a href="${wwwroot}/admin/job/cancel?id=${(row.id)!}" class="btn btn-default" data-toggle="doajax" >取消</a>-->
                            <#--<#else>-->
                                <#--<a href="${wwwroot}/admin/job/run?id=${(row.id)!}" class="btn btn-default" data-toggle="doajax" >运行</a>-->
                            <#--</#if>-->
                        <#--</#if>-->
                        <a href="${wwwroot}/admin/job/toaudit?id=${(row.id)!}" class="btn btn-blue" data-toggle="navtab" data-id="form" data-reload-warn="本页已有打开的内容，确定将刷新本页内容，是否继续？" data-title="审核">审核</a>

                    <#--<a href="${wwwroot}/admin/job/edit?id=${(row.id)!}" class="btn btn-blue" data-toggle="navtab" data-id="form" data-reload-warn="本页已有打开的内容，确定将刷新本页内容，是否继续？" data-title="编辑" <#if row.status='EXECUTED'>disabled="true" </#if>>编辑</a>-->
                    <#--<a href="${wwwroot}/admin/job/delete?ids=${(row.id)!}" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除该行信息吗？" <#if row.status='EXECUTED'>disabled="true" </#if>>删</a>-->
                    <#--<a href="${wwwroot}/admin/job/cancel?id=${(row.id)!}" class="btn btn-default" data-toggle="doajax" <#if row.status!='READY'>disabled="true" </#if>>取消</a>-->
                    </td>
                </tr>
                </#list>
                </tbody>
            </table>
        </div>
        <div id="layout" style="margin-left:210px; height:99.9%; overflow:hidden;">
            <table id="listTask" data-width="100%" class="table table-bordered">

            </table>
        </div>
        <br/>

    </div>




</div>



</div>
<@p.pagination pageCtx=pageCtx pageParam=pageParam/>
<script>
    function listByJob(jobId) {

        $.ajax({
            url: "/admin/task/listbyjob"
            , type: "POST"
            , data: "jobId="+jobId+"&random="+new Date().getTime()
            , success: function( data, textStatus, jqXHR ){
                $('#listTask').html(data);
            }
        });
    }

    function runTask(taskId,jobId){

        $.ajax({
            url: "/admin/task/run"
            , type: "POST"
            , data: "id="+taskId+"&random="+new Date().getTime()
            , success: function( data, textStatus, jqXHR ){
//                listByJob(jobId);
                if(data!=null)
                {
                    listByJob(jobId);
                }
            }
        });
    }

    var nIntervId;
</script>

